<?xml version="1.0" encoding="ISO-8859-1" ?>
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml"
      xmlns:ui="http://java.sun.com/jsf/facelets"
      xmlns:h="http://java.sun.com/jsf/html"
      xmlns:f="http://java.sun.com/jsf/core"
      xmlns:ice="http://www.icesoft.com/icefaces/component">

    <ui:composition template="/resources/template/TemplateEFP.xhtml">
        <ui:define name="title">
            <h:outputText value="#{bundle.ListQuestionnaireTitle}"></h:outputText>
        </ui:define>
        <ui:define name="body">
        <ice:form styleClass="jsfcrud_list_form">
            <h:outputText escape="false" value="#{bundle.ListQuestionnaireEmpty}" rendered="#{questionnaireController.items.rowCount == 0}"/>
            <h:panelGroup rendered="#{questionnaireController.items.rowCount > 0}">
                <h:outputText value="#{questionnaireController.pagination.pageFirstItem + 1}..#{questionnaireController.pagination.pageLastItem + 1}/#{questionnaireController.pagination.itemsCount}"/>&nbsp;
                <h:commandLink action="#{questionnaireController.previous}" value="#{bundle.Previous} #{questionnaireController.pagination.pageSize}" rendered="#{questionnaireController.pagination.hasPreviousPage}"/>&nbsp;
                <h:commandLink action="#{questionnaireController.next}" value="#{bundle.Next} #{questionnaireController.pagination.pageSize}" rendered="#{questionnaireController.pagination.hasNextPage}"/>&nbsp;
                <br/>
                <h:dataTable value="#{questionnaireController.items}" var="item" border="0" cellpadding="2" cellspacing="0" rowClasses="jsfcrud_odd_row,jsfcrud_even_row" rules="all" style="border:solid 1px">
                    <h:column>
                        <f:facet name="header">
                            <h:outputText value="&nbsp;"/>
                        </f:facet>
                        <h:graphicImage url="./resources/images/button/lock.png" rendered="#{item.questionnaireBloque}" />
                        <h:graphicImage url="./resources/images/button/unlocked.png" rendered="#{!item.questionnaireBloque}" />
                    </h:column>
                    <h:column>
                        <f:facet name="header">
                            <h:outputText value="#{bundle.ListQuestionnaireTitle_nom}"/>
                        </f:facet>
                        <h:outputText value="#{item.nom}"/>
                    </h:column>
                    <h:column>
                        <f:facet name="header">
                            <h:outputText value="#{bundle.ListQuestionnaireTitle_typeQuestionnaire}"/>
                        </f:facet>
                        <h:outputText value="#{item.typeQuestionnaire}"/>
                    </h:column>
                    <h:column>
                        <f:facet name="header">
                            <h:outputText value="#{bundle.ListQuestionnaireTitle_dateCreation}"/>
                        </f:facet>
                        <h:outputText value="#{item.dateCreation}">
                            <f:converter converterId="calendarConverter" />
                        </h:outputText>
                    </h:column>
                    <h:column>
                        <f:facet name="header">
                            <h:outputText value="#{bundle.ListQuestionnaireTitle_dateValidation}"/>
                        </f:facet>
                        <h:outputText value="#{item.dateValidation}" rendered="#{item.isValide}">
                            <f:converter converterId="calendarConverter" />
                        </h:outputText>
                        <div class="buttons">
                            <ice:commandLink rendered="#{!item.isValide}" action="#{questionnaireController.valider}" styleClass="positive">
                                <img src="./resources/images/button/tick.png" alt="#{bundle.ListQuestionnaireValidLink}"/>
                                <h:outputText value="#{bundle.ListQuestionnaireValidLink}" />
                            </ice:commandLink>
                        </div>
                    </h:column>
                    <h:column>
                        <f:facet name="header">
                            <h:outputText value="#{bundle.ListQuestionnaireTitle_dateDiffusion}"/>
                        </f:facet>
                        <h:outputText value="#{item.dateDiffusion}" rendered="#{item.isDiffuse and item.isValide}">
                            <f:converter converterId="calendarConverter" />
                        </h:outputText>
                        <div class="buttons">
                            <ice:commandLink rendered="#{!item.isDiffuse and item.isValide}" action="#{questionnaireController.diffuser}">
                                <img src="./resources/images/button/send.png" alt="#{bundle.ListQuestionnaireDiffuseLink}"/>
                                <h:outputText value="#{bundle.ListQuestionnaireDiffuseLink}" />
                            </ice:commandLink>
                        </div>
                    </h:column>
                    <h:column>
                        <f:facet name="header">
                            <h:outputText value="#{bundle.ListQuestionnaireTitle_dateCloture}"/>
                        </f:facet>
                        <h:outputText value="#{item.dateCloture}" rendered="#{item.isClos and item.isValide}">
                            <f:converter converterId="calendarConverter" />
                        </h:outputText>
                        <div class="buttons">
                            <ice:commandLink rendered="#{!item.isClos and item.isDiffuse and item.isValide}" action="#{questionnaireController.clore}" styleClass="negative">
                                <img src="./resources/images/button/cross.png" alt="#{bundle.ListQuestionnaireCloseLink}"/>
                                <h:outputText value="#{bundle.ListQuestionnaireCloseLink}" />
                            </ice:commandLink>
                        </div>
                    </h:column>
                    <!--<h:column>
                        <f:facet name="header">
                            <h:outputText value="#{bundle.ListQuestionnaireTitle_createur}"/>
                        </f:facet>
                        <h:outputText value="#{item.createur.prenom} #{item.createur.nom}"/>
                    </h:column>-->
                    <h:column>
                        <f:facet name="header">
                            <h:outputText value="&nbsp;"/>
                        </f:facet>
                        <div class="buttons">
                            <ice:commandLink rendered="#{!item.isValide}" action="#{questionnaireController.tester}" styleClass="testLink">
                                <img src="./resources/images/button/test.png" alt="#{bundle.ListQuestionnaireTestLink}"/>
                                <h:outputText value="#{bundle.ListQuestionnaireTestLink}" />
                            </ice:commandLink>
                            <ice:commandLink rendered="#{item.isClos}" action="#{questionnaireController.finish}" styleClass="finish">
                                <img src="./resources/images/button/stop.png" alt="#{bundle.ListQuestionnaireFinishLink}"/>
                                <h:outputText value="#{bundle.ListQuestionnaireFinishLink}" />
                            </ice:commandLink>
                            <ice:commandLink rendered="#{!item.isClos and item.isDiffuse and item.isValide and item.questionnaireBloque}" action="#{questionnaireController.debloquer}" styleClass="negative">
                                <img src="./resources/images/button/lock_open.png" alt="#{bundle.ListQuestionnaireUnlockLink}"/>
                                <h:outputText value="#{bundle.ListQuestionnaireUnlockLink}" />
                            </ice:commandLink>
                            <ice:commandLink rendered="#{!item.questionnaireBloque and !item.isClos and item.isDiffuse and item.isValide}" action="#{questionnaireController.bloquer}" styleClass="negative">
                                <img src="./resources/images/button/lock.png" alt="#{bundle.ListQuestionnaireLockLink}"/>
                                <h:outputText value="#{bundle.ListQuestionnaireLockLink}" />
                            </ice:commandLink>
                        </div>
                    </h:column>
                </h:dataTable>
            </h:panelGroup>
            <br />
            <h:panelGroup id="messagePanel" layout="block" styleClass="noBorder">
                <h:messages errorStyle="color: red" infoStyle="color: green" layout="table"/>
            </h:panelGroup>
        </ice:form>
        </ui:define>
    </ui:composition>

</html>
